<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/10/10 0010
 * Time: 15:55
 */
/***
 * 密码加密  截取乱码
 */
function set_password($password)
{
    return substr(md5($password),6,-6);
}
/***
 * 商品显示页面上架.置顶等封装，改变 属性
 */
function is_something($model, $attr)
{
    if (isset($model[$attr]) && $model[$attr] == 1) {
        return '<span class="am-icon-check change_attr" data-attr="' . $attr . '"></span>';

    }
    return'<span class="am-icon-close change_attr" data-attr="'.$attr.'"></span>';

}
/***
 * 生成随机token
 * @return bool|string
 */
function make_token_code()
{
    return substr(implode(NULL, array_map('ord', str_split(substr(uniqid(), 3, 100), 2))), 0, 100);
}
